package com.j4dream.bufferedWriter;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;

public class Fenpei {

	static List<Integer> listCus = new ArrayList<Integer>();

	static List<String> persons = new ArrayList<String>();

	// static Map<String, String> result = new HashMap<String, String>();
	static List<Persons> result = new ArrayList<Persons>();

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		for (int i = 0; i < 20; i++) {
			listCus.add(i);
		}
		for (int j = 0; j < 5; j++) {
			persons.add("person" + j);
		}

		int personSize = persons.size();

		for (int i = 0; i < listCus.size(); i++) {
			Persons p = new Persons();
			p.setI(i);
			p.setPersonname(persons.get(i % personSize));
			result.add(p);
		}
		Iterator it = result.iterator();

		while (it.hasNext()) {
			Persons p = (Persons) it.next();
			System.out.println("哪个人 => " + p.getI() + " 分配到 " + p.getPersonname());
		}
	}

	public static class Persons {
		private Integer i;

		private String personname;

		public Integer getI() {
			return i;
		}

		public void setI(Integer i) {
			this.i = i;
		}

		public String getPersonname() {
			return personname;
		}

		public void setPersonname(String personname) {
			this.personname = personname;
		}
	}

}
